<template>
  <div class="teacher-detail">
    <!-- 返回按钮 -->
    <div class="back-btn" @click="$router.go(-1)">
      ← 返回
    </div>

    <!-- 教师信息 -->
    <div class="teacher-info">
      <h2>张老师</h2>
      <p>计算机科学与技术学院 | 副教授</p>
    </div>

    <!-- 授课情况 -->
    <div class="teaching-status">
      <h3>授课情况</h3>
      <!-- 数据结构课程 -->
      <div class="course">
        <div class="course-time">周一 1-2节</div>
        <div class="course-name">数据结构</div>
        <div class="class-info">
          <div class="class-item" @click="goToClassDetail('1', '1')">
            <span>计算机科学1班 30人</span>
            <div class="stats">
              <div>平均分：85.5</div>
              <div>及格率：95%</div>
              <div>出勤率：98%</div>
            </div>
          </div>
        </div>
      </div>

      <!-- 计算机网络课程 -->
      <div class="course">
        <div class="course-time">周三 3-4节</div>
        <div class="course-name">计算机网络</div>
        <div class="class-info">
          <div class="class-item" @click="goToClassDetail('2', '2')">
            <span>软件工程2班 32人</span>
            <div class="stats">
              <div>平均分：83.2</div>
              <div>及格率：92%</div>
              <div>出勤率：96%</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
const router = useRouter()

// 跳转到班级详情页面
const goToClassDetail = (courseId, classId) => {
  router.push(`/teacher-detail/${route.params.id}/course/${courseId}/class/${classId}`)
}
</script>

<style scoped>
.teacher-detail {
  padding: 20px;
  background: #fff;
}

.back-btn {
  margin-bottom: 20px;
  cursor: pointer;
  display: inline-block;
}

.teacher-info {
  margin-bottom: 30px;
}

.teacher-info h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.teaching-status {
  margin-top: 20px;
}

.course {
  margin-top: 15px;
  border: 1px solid #eee;
  padding: 15px;
  border-radius: 8px;
}

.course-time {
  color: #666;
  margin-bottom: 10px;
}

.course-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
}

.class-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.class-item {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.class-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stats {
  margin-top: 10px;
  display: flex;
  gap: 20px;
  color: #666;
}
</style> 